package com.dk.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dk.entity.DtContent;
import com.dk.mapper.DtContentMapper;
import com.dk.service.IDtContentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2021-12-22
 */
@Service
public class DtContentServiceImpl  implements IDtContentService {

    @Autowired
    private DtContentMapper contentMapper;

    @Override
    public IPage<DtContent> selectPage(Integer pageNum, Integer pageSize) {
        Page<DtContent> page = new Page<>(pageNum, pageSize);
        return  contentMapper.selectPage(page, null);
    }

    @Override
    public void insertContent(DtContent dtContent) {
        contentMapper.insert(dtContent);
    }

    @Override
    public void updateContent(DtContent dtContent) {
        contentMapper.updateById(dtContent);
    }

    @Override
    public DtContent selectContentById(Long id) {
        return contentMapper.selectById(id);
    }

    @Override
    public void deleteContentById(Long id) {
        contentMapper.deleteById(id);
    }
}
